<div class="block-news">
<?
$tag = ','.str_replace('-',' ',$_GET['keyword']).',';
//$tag = str_replace('-',' ',$_GET['keyword']);
$per_page = 20;
$page_no = $p-1<=0 ? 0 : $p-1;
$first = ($page_no) * $per_page;
$limit = $first . ',' . $per_page;
$Arr_pros =  getArray('xteam_product','tags like "%'.$tag.'%"',NULL,'is_hot DESC,date_added DESC, sort ASC');
if($Arr_pros){
    $total=count($Arr_pros);
    foreach ($Arr_pros as $row){
        $class = ++$num%2!=0? "block-left":"block-right";
        if($parid[$row['parent_id']]%2==0){$class_sp="rental";}else{$class_sp="salse";}?>
            <div class="<?=$class?>">
                <h2 class="title-news">
                    <?=$row['is_hot']==1?'<img src="'.$curHost.'images/hot.gif" alt="'.utf8_to_ascii($row['name']).'" />':''?>
                    <a href="<?=$curHost.str_replace(array('--','--'), '-', utf8_to_ascii($parname[$row['parent_id']])).'/'.str_replace(array('--','--'), '-', utf8_to_ascii($parseokey[$row['parent_id']]))?>/7/<?=$parid[$row['parent_id']]?>.html">
                        <span class="<?=$class_sp?>"><?=$parname[$row['parent_id']]?> | </span>
                    </a>
                    <a href="<?=$curHost.utf8_to_ascii($parent=$parseokey[$row['parent_id']]!=''?$parseokey[$row['parent_id']]:$parname[$row['parent_id']])?>/<?=str_replace(array('--','--'), '-', utf8_to_ascii($name=$row['seo_key']!=''?$row['seo_key']:$row['name']))?>/1/<?=$row['id']?>.html" title="<?=$row['name']?>">
                        <?=$row['name']?>
                    </a>
                </h2>
                <a href="<?=$curHost.utf8_to_ascii($parent=$parseokey[$row['parent_id']]!=''?$parseokey[$row['parent_id']]:$parname[$row['parent_id']])?>/<?=str_replace(array('--','--'), '-', utf8_to_ascii($name=$row['seo_key']!=''?$row['seo_key']:$row['name']))?>/1/<?=$row['id']?>.html" title="<?=$row['name']?>">
                    <? if($row['image_thumbs']){?>
                    <img class="img-news" src="<?=$curHost?><?=$row['image_thumbs']?>" title="<?=$row['name']?>" alt="<?=$row['name']?>" />
                    <? }else{?>
                    <img src="<?=$curHost?>images/no_image.gif" alt="<?=$row['seo_key']." - ".$row["name"]?>"  class="img-news" style="display: inline;" title="<?=$row['name']?>" />
                    <? }?>
                </a>
                <div class="short-news">
                <? $properties = product_properties($row['id']);?>
                    <ul>
                    <?
                    if($properties){
                        foreach($properties as $prop){?>
                        <li><label><?=$prop['cat']?>:&nbsp;</label><span><?=$prop['name']?></span></li>
                        <?
                        }
                    }else{?>
                        <li><label>đang cập nhật</label></li>
                    <? }?>
                    </ul>
                </div>
            </div>
        <? if($num%2==0){echo '<div class="clear"></div></div><div class="block-news">';}
    }
}
?>
    <div class="clear"></div>
</div>
<?
if($_lang=="vn"){
	$rowPage 	= "Sản phẩm";
	$pagePage 	= "Trang";
	$titleFirst 	= "Đầu Tiên";
	$titlePrevious 	= "Về trước";
	$titleNext 	= "Tiếp theo";
	$titleLast 	= "Cuối cùng";
}else if($_lang=="en"){
	$rowPage = "Products";
	$pagePage 	= "Page";
	$titleFirst 	= "First";
	$titlePrevious 	= "Previous";
	$titleNext 	= "Next";
	$titleLast 	= "Last";
}else{
	$rowPage = "產品";
	$pagePage 	= "頁";
	$titleFirst 	= "首先";
	$titlePrevious 	= "上一頁";
	$titleNext 	= "下一頁";
	$titleLast 	= "最後";
}
$page = countPages($total,$per_page);
if($total>$per_page || $page_no>0){
?>
<div class="pagging">
    <ul class="page-numbers">
    <? if($page>1){?>
        <li><a title="<?=$titleFirst?>" id="first" href="<?=$curHost?>tags/<?=utf8_to_ascii($_GET['keyword'])?>/page-1.html"><?=$titleFirst?></a></li>
        <li><a title="<?=$titlePrevious?>" id="previous" href="<?=$curHost?>tags/<?=utf8_to_ascii($_GET['keyword'])?>/page-<? if($p-1<0){echo $p=1;}else{echo $p-1;}?>.html"><?=$titlePrevious?></a></li>
        <?
        $from=($p-10>0?$p-10:0);
        $to=($p+10<$pages?$p+10:$pages);
        for ($i=$from;$i<$to;$i++){
            if ($i+1!=$p) {?> <li><a href="<?=$curHost?>tags/<?=utf8_to_ascii($_GET['keyword'])?>/page-<?=$i+1?>.html"><?=$i+1?></a></li>
        <? }else{?>
        <li><a class="active"><?=($i+1)?></a></li>
        <? }
        }?>
        <li><a title="<?=$titleNext?>" id="next" href="<?=$curHost?>tags/<?=utf8_to_ascii($_GET['keyword'])?>/page-<? if($p+1>$pages){echo $p=$pages;}else{echo $p+1;}?>.html"><?=$titleNext?></a></li>
        <li><a title="<?=$titleNext?>" id="last" href="<?=$curHost?>tags/<?=utf8_to_ascii($_GET['keyword'])?>/page-<?=$p=$pages?>.html"><?=$titleLast?></a></li>
    <? }?>
    </ul>
</div>
<? }?>
<script language="javascript" type="text/javascript">
    $(document).ready(function(){
        var contentdiv = $('.block-news').text(function(){
            if ($.trim($(this).text())==''){
                $(this).hide();
            }
        });
    })
</script>